#include <iostream>
#include <cmath>
using namespace std;

int perfect_num(int m)
{
	int sum = 0;
	for(int j = 1;j < m;j++)
	{
		if( m % j == 0)
		   sum +=j;
	}
	if(sum == m)
	return 1;
	else
	return 0;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 2;i <= n;i++)
	{
		if(perfect_num(i))
		{
			cout << i << endl;
		}
	}
	return 0;
}
